from api.feishu_api import FeiShu
from entity.calendar_entity import CalendarEntity
from dataclasses import asdict


class CalendarApi(FeiShu):
    # 获取主日历
    def get_calendar_by_main(self):
        pass

    # 创建日历
    def create_calendar(self, calendar: CalendarEntity):
        url = "/calendar/v4/calendars"
        headers = {
            "Content-Type": "application/json;charset=utf-8"
        }
        body = asdict(calendar)
        r = self.send("post", url, headers=headers, json=body)
        return r.json()

    # 删除日历
    def del_calender(self):
        pass

    # 获取日历
    def get_calendar(self, calendar_id):
        url = f"/calendar/v4/calendars/{calendar_id}"
        r = self.send("get", url)
        return r.json()

    # 获取日历列表
    def get_calendar_list(self):
        url = "/calendar/v4/calendars"
        r = self.send("get", url)
        return r.json()

    # 更新日历
    def update_calendar(self):
        pass

    # 搜索日历
    def search_calendar(self):
        pass

    # 订阅日历
    def subscribe_calendar(self):
        pass

    # 取消订阅日历
    def unsubscribe_calendar(self):
        pass

    # 订阅日历变更事件
    def subscription_calendar(self):
        pass

    # 取消订阅日历变更事件
    def unsubscription_calendar(self):
        pass
